package com.common.tree;

import java.util.LinkedList;
import java.util.List;

public class EntryWrapper<T> implements Node {

    public static <T> EntryWrapper<T> create(String value, String parentValue, T t) {
        return new EntryWrapper<>(value, parentValue, t);
    }

    private EntryWrapper(String value, String parentValue, T node) {
        this.value = value;
        this.parentValue = parentValue;
        this.node = node;
    }

    private String value;
    private String parentValue;

    private List<EntryWrapper<T>> children;
    private T node;

    public void add(EntryWrapper<T> node) {
        if (children == null) {
            children = new LinkedList<>();
        }
        children.add(node);
    }

    public List<EntryWrapper<T>> getChildren() {
        return children;
    }

    public void setChildren(List<EntryWrapper<T>> children) {
        this.children = children;
    }

    public T getNode() {
        return node;
    }

    public void setNode(T node) {
        this.node = node;
    }

    @Override
    public String getParentValue() {
        return parentValue;
    }

    @Override
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public void setParentValue(String parentValue) {
        this.parentValue = parentValue;
    }
}
